/**  
 * Project Name:api-webhook  
 * File Name:EmailClient.java  
 * Package Name:com.example.service.webhook.api  
 * Date:2016年7月19日下午5:17:42  
 * Copyright (c) 2016, yuandong@51dojo.com All Rights Reserved.  
 *  
*/  
  
package com.example.service.webhook.business.qq.api;

import com.example.service.webhook.api.MoxieClient;
import com.example.service.webhook.business.qq.dto.QQData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import retrofit2.Call;
import retrofit2.Response;

import java.io.IOException;

/**
 * 京东client
 * ClassName: JingdongClient    
 * date: 2016年9月9日 上午11:48:06   
 * @author yuandong  
 * @version   
 * @since JDK 1.6
 */
@Component
public class QqClient extends MoxieClient {
	
	private static final Logger LOGGER = LoggerFactory.getLogger(QqClient.class);
	
	 private QqApi api;
	 
	 @Autowired
	public QqClient(@Value("${moxie.api.baseUrl}") String apiBaseUrl,
            @Value("${moxie.api.token}") String apiToken) {
		super(apiBaseUrl, apiToken);  
		api = retrofit.create(QqApi.class);
	}
	
//	public List<QQContact> getContacts(String taskId) throws IOException {
//        Call<List<QQContact>> call = api.getContacts(taskId);
//        Response<List<QQContact>> response = call.execute();
//        if (response.code() == 200) {
//            return response.body();
//        } else {
//            LOGGER.info("qq getContacts, status:{}, message:{}", response.code(), response.message());
//        }
//        return null;
//    }
//
//
//	public QQUserInfo getUserInfo(String taskId) throws IOException {
//        Call<QQUserInfo> call = api.getUserInfo(taskId);
//        Response<QQUserInfo> response = call.execute();
//        if (response.code() == 200) {
//            return response.body();
//        } else {
//            LOGGER.info("qq getUserInfo, status:{}, message:{}", response.code(), response.message());
//        }
//        return null;
//    }
//
//	public List<QQPersonalInterests> getUserInterests(String taskId) throws IOException {
//        Call<List<QQPersonalInterests>> call = api.getUserInterests(taskId);
//        Response<List<QQPersonalInterests>> response = call.execute();
//        if (response.code() == 200) {
//            return response.body();
//        } else {
//            LOGGER.info("qq getUserInterests, status:{}, message:{}", response.code(), response.message());
//        }
//        return null;
//    }
//
//
//	public List<QQRecentContact> getQQRecentContact(String taskId) throws IOException {
//        Call<List<QQRecentContact>> call = api.getQQRecentContact(taskId);
//        Response<List<QQRecentContact>> response = call.execute();
//        if (response.code() == 200) {
//            return response.body();
//        } else {
//            LOGGER.info("qq getQQRecentContact, status:{}, message:{}", response.code(), response.message());
//        }
//        return null;
//    }
//
//	public List<QqGroup> getQqGroup(String taskId) throws IOException {
//        Call<List<QqGroup>> call = api.getQqGroup(taskId);
//        Response<List<QqGroup>> response = call.execute();
//        if (response.code() == 200) {
//            return response.body();
//        } else {
//            LOGGER.info("qq getQqGroup, status:{}, message:{}", response.code(), response.message());
//        }
//        return null;
//    }
//
//	public List<QQGroupMember> getQQGroupMember(String taskId) throws IOException {
//        Call<List<QQGroupMember>> call = api.getQQGroupMember(taskId);
//        Response<List<QQGroupMember>> response = call.execute();
//        if (response.code() == 200) {
//            return response.body();
//        } else {
//            LOGGER.info("qq getQqGroup, status:{}, message:{}", response.code(), response.message());
//        }
//        return null;
//    }




    public QQData getQQData(String taskId) throws IOException {
        Call<QQData> call = api.getQQData(taskId);
        Response<QQData> response = call.execute();
        if (response.code() == 200) {
            return response.body();
        } else {
            LOGGER.info("qq getQqGroup, status:{}, message:{}", response.code(), response.message());
        }
        return null;
    }
	
	
	
	
	
}
  
